package at.fhooe.engine.time;

public class PandoraTimer {

	public static final String DEFAULT_TIMER_NAME = "default timer";
	
	private String m_name;
	private double m_deltaTime;
	private double m_scale;
	private boolean m_paused;
	private double m_totalElapsedTime;

	public PandoraTimer(String name) {
		m_deltaTime = 0.0;
		m_scale = 1.0;
		m_paused = false;
		m_name = name;
	}
	
	public void update(double deltaTime) {
		if (m_paused) {
			m_deltaTime = 0.0;
			return;
		}
		m_deltaTime = deltaTime * m_scale;
		m_totalElapsedTime += m_deltaTime;
	}

	public double getDeltaTime() {
		return m_deltaTime;
	}
	
	public double getTotalElapsedTime() {
		return m_totalElapsedTime;
	}
	
	public void setScale(double scale) {
		m_scale = scale;
	}
	
	public void setPaused(boolean paused) {
		m_paused = paused;
	}
	
	public boolean isPaused() {
		return m_paused;
	}
	
	public String getName() {
		return m_name;
	}

}
